﻿@model LoginModel
@using Nop.Web.Models.Customer;
@using Nop.Core;
@using Nop.Core.Infrastructure;
@{
    Layout = "~/Views/Shared/_ColumnsOne.cshtml";

    //title
    Html.AddTitleParts(T("PageTitle.Login").Text);

    //register URL with return URL (if specified)
    var registerUrl = Url.RouteUrl("Register");
    if (!String.IsNullOrEmpty(this.Context.Request.QueryString["returnUrl"]))
    {
        var webHelper = EngineContext.Current.Resolve<IWebHelper>();
        registerUrl = webHelper.ModifyQueryString(registerUrl, "returnurl=" + HttpUtility.UrlEncode(this.Context.Request.QueryString["returnUrl"]), null);
    }
}
<div class="page login-page">
    <div class="page-title">
        <h1>@T("Account.Login.Welcome")</h1>
    </div>
    @Html.Partial("_ExternalAuthentication.AssociateMessage")
    @Html.Partial("_ExternalAuthentication.Errors")
    <div class="page-body">
        <div class="customer-blocks">
            @if (Model.CheckoutAsGuest)
            {
                <div class="new-wrapper checkout-as-guest-or-register-block">
                    <div class="title">
                        <strong>@T("Account.Login.CheckoutAsGuestOrRegister")</strong>
                    </div>
                    <div class="text">
                        @Html.Action("TopicBlock", "Topic", new { systemName = "CheckoutAsGuestOrRegister" })
                    </div>
                    <div class="buttons">
                        <input type="button" class="button-1 checkout-as-guest-button" onclick="location.href='@Url.RouteUrl("Checkout")'" value="@T("Account.Login.CheckoutAsGuest")" />
                        <input type="button" class="button-1 register-button" onclick="location.href='@registerUrl'" value="@T("Account.Register")" />
                    </div>
                </div>
            }
            else
            {
                <div class="new-wrapper register-block">
                    <div class="title">
                        <strong>@T("Account.Login.NewCustomer")</strong>
                    </div>
                    <div class="text">
                        @T("Account.Login.NewCustomerText")
                    </div>
                    <div class="buttons">
                        <input type="button" class="button-1 register-button" onclick="location.href='@registerUrl'" value="@T("Account.Register")" />
                    </div>
                </div>
            }
            <div class="returning-wrapper">
                <div class="title">
                    <strong>@T("Account.Login.ReturningCustomer")</strong>
                </div>
                <div class="form-fields">
                    @using (Html.BeginForm())
                    {
                        <div class="message-error">
                            @Html.ValidationSummary(true, T("Account.Login.Unsuccessful").Text)
                        </div>
                        if (Model.UsernamesEnabled)
                        {
                        <div class="inputs">
                            @Html.LabelFor(m => m.Username, new { }, ":") 
                            @Html.TextBoxFor(m => m.Username, new { @class = "username", autofocus = "autofocus" })
                            @Html.ValidationMessageFor(m => m.Username)
                        </div>
                        }
                        else
                        {
                        <div class="inputs">
                            @Html.LabelFor(m => m.Email, new { }, ":")
                            @Html.TextBoxFor(m => m.Email, new { @class = "email", autofocus = "autofocus" })
                            @Html.ValidationMessageFor(m => m.Email)
                        </div>
                        }
                        <div class="inputs">
                            @Html.LabelFor(m => m.Password, new { }, ":")
                            @Html.PasswordFor(m => m.Password, new { @class = "password" })
                            @Html.ValidationMessageFor(m => m.Password)
                        </div>
                        <div class="inputs reversed">
                            @Html.CheckBoxFor(m => m.RememberMe)
                            @Html.LabelFor(m => m.RememberMe)
                            <span class="forgot-password">
                                @Html.RouteLink(T("Account.Login.ForgotPassword").Text, "PasswordRecovery")
                            </span>
                        </div>
                        if (Model.DisplayCaptcha)
                        {
                        <div class="captcha-box">
                            @Html.Raw(Html.GenerateCaptcha())
                        </div>
                        }
                        <div class="buttons">
                            <input class="button-1 login-button" type="submit" value="@T("Account.Login.LoginButton")" />
                        </div>
                       
                    }
                </div>
            </div>
        </div>
        <div class="external-authentication">
            @Html.Action("ExternalMethods", "ExternalAuthentication")
        </div>
        @Html.Action("TopicBlock", "Topic", new { systemName = "LoginRegistrationInfo" })
    </div>
</div>
